package com.thwj.project.app.api;

import com.thwj.framework.web.domain.R;
import com.thwj.project.amap.dto.AppLocationDTO;
import com.thwj.project.app.api.vo.CityViewVo;
import com.thwj.project.app.service.AppAreaService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import java.util.List;

@Slf4j
@Api(tags="app 行政区域相关")
@RestController
@RequestMapping("/app/area")
public class AppAreaController {


    @Autowired
    private AppAreaService appAreaService;


    @ApiOperation(value = "获取城市含首字母列表",notes = "获取城市含首字母列表")
    @GetMapping("/getCityViewVoList")
    public R<List<CityViewVo>> getCityViewVoList() {
        List<CityViewVo> cityViewVoList = appAreaService.getCityViewVoList();
        return R.data(cityViewVoList);
    }

    @ApiOperation(value = "根据经纬度获取行政区域信息",notes = "目前需要使用 城市名 和城市code  code 是用于 后面请求列表 的参数")
    @GetMapping("/getAppLocationVo")
    public R<AppLocationDTO> getAppLocationVo() {
        AppLocationDTO appLocationDTO = appAreaService.getAppLocationVo(true);
        return R.data(appLocationDTO);
    }


}
